This repository has been archived by the owner on Apr 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
timers: fix timers with non-integer delay hanging. #8073
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Looks good to me, would love to get @tjfontaine's +1. Great work! |
When backporting f8193ab into v0.10, a regression was introduced. Timers with non-integer timeout could trigger a infinite recursion with 100% cpu usage. This commit backports 93b0624 which fixes the regression. After backporting f8193ab, instead of using Date.now(), timers would use Timer.now() to determine if they had expired. However, Timer.now() is based on loop->time, which is not updated when a timer's remaining time is > 0 and < 1. Timers would thus never timeout if their remaining time was at some point > 0 and < 1. With this commit, Timer.now() updates loop->time itself, and timers always timeout eventually. Fixes nodejs#8065 and nodejs#8068.
misterdjules
changed the title
timers: fix issue #8065.
timers: fix timers with non-integer delay hanging.
Aug 4, 2014
Thanks landed in 6f04394 |
I think I am running into this issue. Everything seems to work fine, but after a few days node just locks up with 100% CPU usage. In the debugger I can see that while (first = L.peek(list)) {
var diff = now - first._monotonicStartTime;
if (diff < msecs) {
list.start(msecs - diff, 0);
debug(msecs + ' list wait because diff is ' + diff);
return;
} else {
// ...
} Could you please confirm that I am running into the same issue discussed here? Or is this another problem? |
@florianreinhart Yep, this is the same issue. |
This was referenced Aug 13, 2014
This was referenced Aug 13, 2014
timoxley
added a commit
to timoxley/functional-javascript-workshop
that referenced
this pull request
Aug 19, 2014
Related to nodejs/node-v0.x-archive#8073 Reported in nodeschool/discussions#486
misterdjules
pushed a commit
to misterdjules/node
that referenced
this pull request
Aug 26, 2014
PR nodejs#8034 came with a test to make sure that timers expiry is based on monotonic time and not on wall-clock time. However, a bug in the implementation broke timers with non-integer delays. A fix for this issue was provided with PR nodejs#8073, but it didn't come with a test. Because nodejs#8073 fixed a subtle issue that could reappear in the future, and because the impact of such an issue would be significant, I suggest adding this test. The test would timeout after 1 minute if the issue was reproduced. Otherwise it will run very quickly.
misterdjules
pushed a commit
to misterdjules/node
that referenced
this pull request
Aug 27, 2014
PR nodejs#8034 came with a test to make sure that timers expiry is based on monotonic time and not on wall-clock time. However, a bug in the implementation broke timers with non-integer delays. A fix for this issue was provided with PR nodejs#8073, but it didn't come with a test. Because nodejs#8073 fixed a subtle issue that could reappear in the future, and because the impact of such an issue would be significant, I suggest adding this test. The test would timeout after 1 minute if the issue was reproduced. Otherwise it will run very quickly.
indutny
pushed a commit
that referenced
this pull request
Sep 2, 2014
PR #8034 came with a test to make sure that timers expiry is based on monotonic time and not on wall-clock time. However, a bug in the implementation broke timers with non-integer delays. A fix for this issue was provided with PR #8073, but it didn't come with a test. Because #8073 fixed a subtle issue that could reappear in the future, and because the impact of such an issue would be significant, I suggest adding this test. The test would timeout after 1 minute if the issue was reproduced. Otherwise it will run very quickly. Reviewed-By: Fedor Indutny <[email protected]>
mscdex
pushed a commit
to mscdex/node
that referenced
this pull request
Dec 25, 2014
PR nodejs#8034 came with a test to make sure that timers expiry is based on monotonic time and not on wall-clock time. However, a bug in the implementation broke timers with non-integer delays. A fix for this issue was provided with PR nodejs#8073, but it didn't come with a test. Because nodejs#8073 fixed a subtle issue that could reappear in the future, and because the impact of such an issue would be significant, I suggest adding this test. The test would timeout after 1 minute if the issue was reproduced. Otherwise it will run very quickly. Reviewed-By: Fedor Indutny <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When backporting f8193ab into v0.10, a regression was introduced. Timers
with non-integer timeout could trigger a infinite recursion with 100%
cpu usage. This commit backports 93b0624 which fixes the regression.
After backporting f8193ab, instead of using Date.now(), timers would use
Timer.now() to determine if they had expired. However, Timer.now() is
based on loop->time, which is not updated when a timer's remaining time
is > 0 and < 1. Timers would thus never timeout if their remaining time
was at some point > 0 and < 1.
With this commit, Timer.now() updates loop->time itself, and timers
always timeout eventually.
Fixes #8065 and #8068.